home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
clipper
/
clipwndw.zip
/
CWINDOW.PRG
< prev
next >
Wrap
Text File
|
1990-05-08
|
20KB
|
604 lines
***********************************************************************
*
* These are a group of functions that I wrote for Clipper. They
* enable me to use a very SIMPLE windowing system to approach the
* user. I am letting anyone use this, just mention me in your program.
* I should warn you that the following code is pure Clipper and needs to
* be extended.
*
* Use, enhance and develop, then buy a good 'C' compiler and do
* your databasing in that. spelled 'see code base 4'.
* You can define GOOD.
*
*
* If you need help or just have a question you can contact me at
*
*
* Robert Innes
* (701) 293-8739 Home after 6
* innes @ plains internet address
* rinnes @ extnet.plains.edu
*
*
* If I am not there.
* Please note the date and remember people do move on. ENJOY !!
***************************************************************************
*:**********************************************************************:
*: Program: CWINDOW.PRG
*:
*: System: Window Library for Clipper
*: Author: Robert Innes
*: Last modified: 06/08/89 10:12
*:
*: Procs & Fncts: WCOLOR() - set the colors for a window
*: : MAKE_WINDOW() - build and show a window
*: : WTITLE() - title a window
*: : WSAYAT() - put a string, with clipping in a window
*: : WMENU() - display a windowed' achoice
*: : REMOVE_WINDOW() - delete a window, restore if needed
*: : HOME_CURSOR - set the cursor to home
*: : WTRUNC_STR() - internal string truncation
*: : INRANGE() - see if coords are valid internal
*: : WGOTOXY - got to a point in a window
*: : WMESSAGE - pop up a message, various levels
*:
*:*********************************************************************
* Window Library For Clipper
*
* DECLARE a Public STRING ARRAY
*
* window[1] - Top of Window
* window[2] - Left of Window
* window[3] - Bottom of Window
* window[4] - Right of Window
* window[5] - ForeGround Color of Window
* window[6] - Background Color of Window
* window[7] - Title of Window
* window[8] - Does it Have a Shadow ?
* window[9] - Current Row of Cursor
* window[10]- Current Column of Cursor
* window[11]- Old Row of Cursor
* window[12]- Old Column of Cursor
* window[13]- Save contents under window ?
* window[14] - Window Save Buffer
*
*
* Public Defines for window Routines
*
* YES, virginia, you need these.
*
PUBLIC shadow, noshadow, shadow_color, saveit, notsave, choic
shadow = 1
noshadow = 0
shadow_color = '+/W'
saveit = 1
notsave = 0
*
* Currently all windows have double borders 'cause I was to lazy
* to do any others.
*
DOUBLE = CHR(201) + CHR(205) + CHR(187) + CHR(186) + CHR(188) + CHR(205) +;
CHR(200) + CHR(186) + CHR(32)
******************************************************
*
* The following code is the test procedure. This can
* be taken out when you get the hang of it.
*
* or use the preprocessor you have when you bought
* that GOOD 'C' compiler. ;-)
******************************************************
PUBLIC win1[14], menu1[20], menuv[20] && DEFINE PUBLIC VARIABLES
menu1[1] = 'Number 1' && wpop menu
menu1[2] = 'Number 2' && wpop menu
menu1[3] = 'Number 3' && wpop menu
menu1[4] = 'Number 4' && wpop menu
menu1[5] = 'Number 5' && wpop menu
menu1[6] = 'Number 6' && wpop menu
menu1[7] = 'Number 7' && wpop menu
menu1[8] = 'Number 8' && wpop menu
menu1[9] = 'Number 9' && wpop menu
menu1[10] = 'Number 10' && wpop menu
menu1[11] = 'Number 11' && wpop menu
menu1[12] = 'Number 12' && wpop menu
menu1[13] = 'Number 13' && wpop menu
menu1[14] = 'Number 14' && wpop menu
menu1[15] = 'Number 15' && wpop menu
menu1[16] = 'Number 16' && wpop menu
menu1[17] = 'Number 17' && wpop menu
menu1[18] = 'Number 18' && wpop menu
menu1[19] = 'Number 19' && wpop menu
menu1[20] = 'Number 20' && wpop menu
*
* If an option is set to false then it is displayed but not
* selectable. See achoice in the clipper manual.
*
menuv[1] = .T. && wpop menu
menuv[2] = .T. && wpop menu
menuv[3] = .T. && wpop menu
menuv[4] = .T. && wpop menu
menuv[5] = .F. && wpop menu
menuv[6] = .T. && wpop menu
menuv[7] = .F. && wpop menu
menuv[8] = .T. && wpop menu
menuv[9] = .T. && wpop menu
menuv[10] = .T. && wpop menu
menuv[11] = .T. && wpop menu
menuv[12] = .T. && wpop menu
menuv[13] = .T. && wpop menu
menuv[14] = .T. && wpop menu
menuv[15] = .T. && wpop menu
menuv[16] = .T. && wpop menu
menuv[17] = .T. && wpop menu
menuv[18] = .T. && wpop menu
menuv[19] = .T. && wpop menu
menuv[20] = .T. && wpop menu
win1[1] = STR(5)
win1[2] = STR(5)
win1[3] = STR(20)
win1[4] = STR(40)
win1[8] = STR(shadow)
win1[13]= STR(saveit)
wcolor( win1, 'BG', ' ')
win1[14] = make_window( win1 )
wtitle(win1, 'This is window Number 1')
wsayat( win1, 5, 5, 'A String')
wsayat( win1, 6, 5, 'A Very Very Long String That Should Not Print Far' )
wmessage(10, 10, 'Just a Note', 1)
wmessage(10, 10, 'Just a Warning, Improper Input', 2)
wmessage(10, 10, 'Error has Occured', 3)
wmessage(10, 10, 'Everything is OK', 9)
choic = wpop_menu( 5, 5, 'Choices', 20, menu1, menuv )
wsayat( win1, 7, 5, 'Choice = ' + LTRIM(STR(choic) ) )
INKEY(0)
remove_window( win1 )
RETURN && return to calling program
*!*********************************************************************
*!
*! Function: MAKE_WINDOW()
*!
*! Called by: CWINDOW.PRG
*! : WMENU() (function in CWINDOW.PRG)
*! : WMESSAGE (procedure in CWINDOW.PRG)
*!
*! Calls: HOME_CURSOR (procedure in CWINDOW.PRG)
*!
*!*********************************************************************
FUNCTION make_window
PARAMETERS WINDOW
PRIVATE wtop, wright, wbot, wleft, Buffer, shadow_bot, shadow_right, old_color && DEFINE PRIVATE VARIABLES
PRIVATE wcolor && DEFINE PRIVATE VARIABLES
PRIVATE TOP, RIGHT, bot, LEFT && DEFINE PRIVATE VARIABLES
*
* Convert window values to integer
*
TOP = VAL(WINDOW[1])
LEFT = VAL(WINDOW[2])
bot = VAL(WINDOW[3])
RIGHT = VAL(WINDOW[4])
*
* Set up actual window; inside minus border
*
wtop = VAL(WINDOW[1]) + 1
wleft = VAL(WINDOW[2]) + 1
wbot = VAL(WINDOW[3]) - 1
wright = VAL(WINDOW[4]) - 1
*
* Save the Window underneath
*
IF VAL(WINDOW[13]) == saveit
IF VAL(WINDOW[8]) == noshadow
Buffer = Savescreen( TOP, LEFT, bot, RIGHT )
ELSE